//
//  InputDataView.m
//  IpadTestB
//
//  Created by edianzu on 2017/7/7.
//  Copyright © 2017年 ruilai. All rights reserved.
//

#import "InputDataView.h"

@implementation InputDataView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

-(void) creatUI{
    self.backgroundColor = [UIColor whiteColor];
    //上方绿色VIEW
    self.greenView = [[UIView alloc]init];
    self.greenView.backgroundColor = UIColorFromRGB(26, 167, 157);
    [self addSubview:self.greenView];
    [self.greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(self);
        make.height.mas_equalTo(40*AutoScaleVertical);
    }];
    //添加孩子
    self.childName = [[UILabel alloc]init];
    self.childName.text = @"添加孩子";
    self.childName.textColor = [UIColor whiteColor];
    [self.childName setTextAlignment:NSTextAlignmentCenter];
    self.childName.font = [UIFont boldSystemFontOfSize:20*AutoScaleHorizontal];
    [self.greenView addSubview:self.childName];
    [self.childName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.greenView.mas_centerX);
        make.centerY.mas_equalTo(self.greenView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(200*AutoScaleHorizontal, 20*AutoScaleVertical));
    }];
    //取消按钮
    self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.cancelBtn setImage:[UIImage imageNamed:@"cancelBtn"] forState:UIControlStateNormal];
    [self.greenView addSubview:self.cancelBtn];
    [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.childName.mas_centerY);
        make.right.mas_equalTo(self.greenView.mas_right).with.offset(-20*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(20*AutoScaleHorizontal, 20*AutoScaleVertical));
    }];
    
    self.projectLabel = [[UILabel alloc]init];
    self.projectLabel.text = @"15米节奏折返跑";
    self.projectLabel.textColor = [UIColor blackColor];
    [self.projectLabel setTextAlignment:NSTextAlignmentRight];
    self.projectLabel.font = [UIFont systemFontOfSize:20*AutoScaleHorizontal];
    [self addSubview:self.projectLabel];
    [self.projectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left);
        make.top.mas_equalTo(self.greenView.mas_bottom).with.offset(65*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(190*AutoScaleHorizontal, 25*AutoScaleVertical));
    }];
    self.starLabel = [[UILabel alloc]init];
    self.starLabel.text = @"*";
    self.starLabel.textColor = [UIColor redColor];
    [self.starLabel setTextAlignment:NSTextAlignmentCenter];
    self.starLabel.font = [UIFont boldSystemFontOfSize:20*AutoScaleHorizontal];
    [self addSubview:self.starLabel];
    [self.starLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.projectLabel.mas_right);
        make.centerY.mas_equalTo(self.projectLabel.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(20*AutoScaleHorizontal, 20*AutoScaleVertical));
    }];
    
    self.inputTextField = [[UITextField alloc]init];
    self.inputTextField.layer.borderWidth = 1;
    self.inputTextField.keyboardType = UIKeyboardTypeNumberPad;
    self.inputTextField.layer.borderColor = UIColorFromRGB(167, 167, 167).CGColor;
    [self addSubview:self.inputTextField];
    [self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.starLabel.mas_right);
        make.centerY.mas_equalTo(self.projectLabel.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(150*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
    
    self.unitLabel =[[UILabel alloc]init];
    self.unitLabel.text = @"分米";
    self.unitLabel.textColor = [UIColor blackColor];
    [self.unitLabel setTextAlignment:NSTextAlignmentCenter];
    self.unitLabel.font = [UIFont systemFontOfSize:20*AutoScaleHorizontal];
    [self addSubview:self.unitLabel];
    [self.unitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.inputTextField. mas_right).with.offset(10*AutoScaleHorizontal);
        make.centerY.mas_equalTo(self.projectLabel.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(60*AutoScaleHorizontal, 25*AutoScaleVertical));
    }];
    
    self.unTestableBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.unTestableBtn setImage:[UIImage imageNamed:@"selectImg"] forState:UIControlStateNormal];
    [self.unTestableBtn setImage:[UIImage imageNamed:@"selectImgS"] forState:UIControlStateSelected];
    [self addSubview:self.unTestableBtn];
    [self.unTestableBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.projectLabel.mas_right);
        make.top.mas_equalTo(self.inputTextField.mas_bottom).with.offset(40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(40*AutoScaleHorizontal, 40*AutoScaleVertical));
    }];
    
    self.unTestableLabel = [[UILabel alloc]init];
    self.unTestableLabel.text = @"无法测试";
    self.unTestableLabel.textColor = [UIColor blackColor];
    [self.unTestableLabel setTextAlignment:NSTextAlignmentRight];
    self.unTestableLabel.font = [UIFont systemFontOfSize:20*AutoScaleHorizontal];
    [self addSubview:self.unTestableLabel];
    [self.unTestableLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.unTestableBtn. mas_right);
        make.centerY.mas_equalTo(self.unTestableBtn.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(100*AutoScaleHorizontal, 40*AutoScaleVertical));
    }];
    
    self.confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.confirmBtn.layer.cornerRadius= 10;
    self.confirmBtn.backgroundColor = UIColorFromRGB(26, 167, 157);
    [self.confirmBtn setTitle:@"确定" forState:UIControlStateNormal];
    [self.confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.confirmBtn.titleLabel.font = [UIFont systemFontOfSize:20*AutoScaleHorizontal];
    [self addSubview:self.confirmBtn];
    [self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.bottom.mas_equalTo(self.mas_bottom).with.offset(-40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(80*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];


}
@end



















